#ifndef __BSP_TIME_H__
#define __BSP_TIME_H__

#include <stdint.h>
#include "stm32f4xx.h"







/********TIM1_Pin_define********/

/********PWM1********/
#define TIM1_CH1_Pin          	   	GPIO_Pin_9
#define TIM1_CH1_PINSOURCE			GPIO_PinSource4
#define TIM1_CH1_ENABLE			    0

/********PWM2********/
#define TIM1_CH2_Pin          	 	  GPIO_Pin_11
#define TIM1_CH2_PINSOURCE		    	GPIO_PinSource11
#define TIM1_CH2_ENABLE				      0

/********PWM3********/
#define TIM1_CH3_Pin          	   	GPIO_Pin_13
#define TIM1_CH3_PINSOURCE			    GPIO_PinSource13
#define TIM1_CH3_ENABLE				      1

/********PWM4********/
#define TIM1_CH4_Pin          	   	GPIO_Pin_14
#define TIM1_CH4_PINSOURCE			    GPIO_PinSource14
#define TIM1_CH4_ENABLE				      0
/*******************/
#define TIM1_GPIO_CLK             	RCC_AHB1Periph_GPIOE
#define TIM1_GPIO_PORT            	GPIOE


/********TIM3_Pin_define_END********/



/********TIM2_Pin_define********/

/********PWM2********/
#define TIM2_CH1_GPIO_CLK          	RCC_AHB1Periph_GPIOA
#define TIM2_CH1_GPIO_PORT         	GPIOA
#define TIM2_CH1_Pin          	   	GPIO_Pin_2
#define TIM2_CH1_PINSOURCE			GPIO_PinSource2
#define TIM2_CH1_ENABLE			    0

/********PWM1********/
#define TIM2_CH2_GPIO_CLK          	RCC_AHB1Periph_GPIOA
#define TIM2_CH2_GPIO_PORT         	GPIOA
#define TIM2_CH2_Pin          	 	GPIO_Pin_3
#define TIM2_CH2_PINSOURCE		    GPIO_PinSource3
#define TIM2_CH2_ENABLE				0

/********PWM3********/                        
#define TIM2_CH3_GPIO_CLK          	RCC_AHB1Periph_GPIOA
#define TIM2_CH3_GPIO_PORT         	GPIOA
#define TIM2_CH3_Pin          	   	GPIO_Pin_2
#define TIM2_CH3_PINSOURCE			GPIO_PinSource2
#define TIM2_CH3_ENABLE		        1

/********PWM4********/
#define TIM2_CH4_GPIO_CLK          	RCC_AHB1Periph_GPIOA
#define TIM2_CH4_GPIO_PORT         	GPIOA
#define TIM2_CH4_Pin          	   	GPIO_Pin_3
#define TIM2_CH4_PINSOURCE			GPIO_PinSource3
#define TIM2_CH4_ENABLE				1
/********TIM3_Pin_define_END********/




/********TIM3_Pin_define********/

/********PWM2********/
#define TIM3_CH1_GPIO_CLK          	RCC_AHB1Periph_GPIOA
#define TIM3_CH1_GPIO_PORT         	GPIOA
#define TIM3_CH1_Pin          	   	GPIO_Pin_6
#define TIM3_CH1_PINSOURCE			GPIO_PinSource6
#define TIM3_CH1_ENABLE			    1

/********PWM1********/
#define TIM3_CH2_GPIO_CLK          	RCC_AHB1Periph_GPIOA
#define TIM3_CH2_GPIO_PORT         	GPIOA
#define TIM3_CH2_Pin          	 	GPIO_Pin_7
#define TIM3_CH2_PINSOURCE		    GPIO_PinSource7
#define TIM3_CH2_ENABLE				1

/********PWM3********/                        
#define TIM3_CH3_GPIO_CLK          	RCC_AHB1Periph_GPIOB
#define TIM3_CH3_GPIO_PORT         	GPIOB
#define TIM3_CH3_Pin          	   	GPIO_Pin_0
#define TIM3_CH3_PINSOURCE			GPIO_PinSource0
#define TIM3_CH3_ENABLE		        0

/********PWM4********/
#define TIM3_CH4_GPIO_CLK          	RCC_AHB1Periph_GPIOB
#define TIM3_CH4_GPIO_PORT         	GPIOB
#define TIM3_CH4_Pin          	   	GPIO_Pin_1
#define TIM3_CH4_PINSOURCE			GPIO_PinSource1
#define TIM3_CH4_ENABLE				0
/********TIM3_Pin_define_END********/






/********PWM2********/

#define TIM4_CH1_Pin          	   	GPIO_Pin_12
#define TIM4_CH1_PINSOURCE			    GPIO_PinSource12
#define TIM4_CH1_ENABLE			        1

/********PWM1********/
#define TIM4_CH2_Pin          	 	  GPIO_Pin_13
#define TIM4_CH2_PINSOURCE		    	GPIO_PinSource13
#define TIM4_CH2_ENABLE				      1

/********PWM3********/
#define TIM4_CH3_Pin          	   	GPIO_Pin_14
#define TIM4_CH3_PINSOURCE			    GPIO_PinSource14
#define TIM4_CH3_ENABLE				      1

/********PWM4********/
#define TIM4_CH4_Pin          	   	GPIO_Pin_15
#define TIM4_CH4_PINSOURCE			    GPIO_PinSource15
#define TIM4_CH4_ENABLE				      1


#define TIM4_GPIO_CLK             	RCC_AHB1Periph_GPIOD
#define TIM4_GPIO_PORT         	    GPIOD
/********TIM4_Pin_define_END********/

#define POS_PWM  TIM3->CCR2




#define            BASIC_TIM                   TIM2
#define            BASIC_TIM_APBxClock_FUN     RCC_APB1PeriphClockCmd
#define            BASIC_TIM_CLK               RCC_APB1Periph_TIM2
#define            BASIC_TIM_Period            (1000-1)
#define            BASIC_TIM_Prescaler         (42 - 1)
#define            BASIC_TIM_IRQ               TIM2_IRQn
#define            BASIC_TIM_IRQHandler        TIM2_IRQHandler

void BSP_TIME_Config(void);
void TIM3_PWMOutout(uint16_t prescaler, uint16_t period);
#endif





